#ifndef NOBORDERWIDGET_H
#define NOBORDERWIDGET_H

#include "titlebar.h"

#include <QWidget>

class NoborderWidget : public QWidget
{
    Q_OBJECT

public:
    NoborderWidget(QWidget *parent = nullptr);
    ~NoborderWidget();
    // 初始化界面
    void initGUI();
    // 窗口阴影 无边框
    void shadeGUI();

private:

    void mouseDoubleClickEvent(QMouseEvent *event) override;
    void paintEvent(QPaintEvent *event) override;
    void closeEvent(QCloseEvent *event) override;

#if defined (Q_OS_LINUX) && !defined (Q_OS_ANDROID)
    // Linux环境
//    void mouseMoveEvent(QMouseEvent *event) override;
//    void mousePressEvent(QMouseEvent *event) override;

#endif
#if defined (Q_OS_WINDOWS)
    // Windows环境 处理系统原生事件
    bool nativeEvent(const QByteArray &eventType, void *message, long *result) override;
#endif

    // 主要的操作窗口
    QWidget *mainwidget;

    QPoint winpos;
    QPoint mousepos;
    QPoint diffpos;

    TitleBar *titlebar;  // 标题栏
    QWidget *editwidget; // 编辑区域

    int m_nBorderWidth = 5;

private slots:
    void closeCallback();
};
#endif // NOBORDERWIDGET_H
